﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LaughingDog.GameObjects;
using FarseerGames.FarseerPhysics.Factories;
using FarseerGames.FarseerPhysics.Collisions;
using LaughingDog.Managers;

namespace LaughingDog.Components
{
    public class PolygonBody : RigidBody
    {
        private Vertices mVertices = new Vertices();

        /// <summary>
        /// Gets or sets the vertices used for this PolygonBody.
        /// </summary>
        public Vertices Vertices { get { return mVertices; } set { SetVertices(value); } }

        /// <summary>
        /// Creates an instance of a PolygonBody component.
        /// </summary>
        /// <param name="gameObject">The GameObject this Component should be attached to.</param>
        public PolygonBody(GameObject gameObject)
            : base(gameObject)
        {
            mBody = BodyFactory.Instance.CreatePolygonBody(PhysicsManager.Instance.Simulator, mVertices, DEFAULT_MASS);
            mBody.Position = GameObject.Transform.Position;
        }

        private void SetVertices(Vertices vertices)
        {
            mVertices = vertices;                       
        }
    }
}
